﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo061803
{
    class Lbrary
    {
        private int id;
        private string name;
        private int qian;
        private string cbs;
        private string zzxx;
        public Lbrary(){}
        public Lbrary(int id, string name, int qian, string cbs, string zzxx)
        {
            this.id = id;
            this.name = name;
            this.qian = qian;
            this.cbs = cbs;
            this.zzxx = zzxx;
        }

        public int Id { get => id; set => id = value; }
        public string Name { get => name; set => name = value; }
        public string Cbs { get => cbs; set => cbs = value; }
        public string Zzxx { get => zzxx; set => zzxx = value; }
        public int Qian
        {
            get { return qian; }
            set
            {
                if (value >=0)  //判断 写入的值是否满足if条件 如果是，赋值0
                {
                    Console.WriteLine("价格小于0！默认为0");
                    value = 0;
                }
                qian = value;
            }
        }
        public void Output()
        {
            Console.WriteLine("编号：{0}，书名：{1}，价格：{2}，出版社：{3}，作者信息：{4}", this.id, this.name, this.qian, this.cbs, this.zzxx);

        }
    }
}
